
package com.insigma.business.qrcode.common.converter;



import com.insigma.business.qrcode.soldier.dto.PlacementThroughTrainApplyInfoBSearcher;
import com.insigma.business.qrcode.soldier.dto.PlacementThroughTrainApplyInfoDTO;
import com.insigma.business.qrcode.soldier.dto.PlacementThroughTrainApplyInfoSearchRequest;
import com.insigma.business.qrcode.soldier.entity.PlacementThroughTrainApplyInfoDO;
import com.insigma.business.qrcode.soldier.request.PlacementThroughTrainApplyInfoInsertRequest;
import com.insigma.business.qrcode.soldier.request.PlacementThroughTrainApplyInfoUpdateRequest;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class PlacementThroughTrainApplyInfoProviderConverter extends AbstractConverter<PlacementThroughTrainApplyInfoDTO, PlacementThroughTrainApplyInfoDO> {

    private final static PlacementThroughTrainApplyInfoProviderConverter placementThroughTrainApplyInfoConverter = new PlacementThroughTrainApplyInfoProviderConverter();

    private PlacementThroughTrainApplyInfoProviderConverter(){}

    
    public static PlacementThroughTrainApplyInfoBSearcher convertRequestSO2Searcher(final PlacementThroughTrainApplyInfoSearchRequest request){
        final PlacementThroughTrainApplyInfoBSearcher placementThroughTrainApplyInfoBSearcher = new PlacementThroughTrainApplyInfoBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,placementThroughTrainApplyInfoBSearcher);
        return placementThroughTrainApplyInfoBSearcher;
    }

    
    public static PlacementThroughTrainApplyInfoDO convertRequestUO2DO(final PlacementThroughTrainApplyInfoUpdateRequest placementThroughTrainApplyInfoUpdateRequest) {
        final PlacementThroughTrainApplyInfoDO placementThroughTrainApplyInfoDO = new PlacementThroughTrainApplyInfoDO();
        BeanUtils.copyProperties(placementThroughTrainApplyInfoUpdateRequest,placementThroughTrainApplyInfoDO);
        
        return placementThroughTrainApplyInfoDO;
    }

    
    public static PlacementThroughTrainApplyInfoDO convertRequestIO2DO(final PlacementThroughTrainApplyInfoInsertRequest placementThroughTrainApplyInfoInsertRequest) {
        final PlacementThroughTrainApplyInfoDO placementThroughTrainApplyInfoDO = new PlacementThroughTrainApplyInfoDO();
        BeanUtils.copyProperties(placementThroughTrainApplyInfoInsertRequest,placementThroughTrainApplyInfoDO);
        return placementThroughTrainApplyInfoDO;
    }

    
    public static List<PlacementThroughTrainApplyInfoDTO> convertResponseDOList2DTOList(final List<PlacementThroughTrainApplyInfoDO> placementThroughTrainApplyInfoDOList){
        return placementThroughTrainApplyInfoConverter.convertGenericResponseDOList2DTOList(placementThroughTrainApplyInfoDOList);
    }

    
    public static PlacementThroughTrainApplyInfoDTO convertResponseDO2DTO(final PlacementThroughTrainApplyInfoDO placementThroughTrainApplyInfoDO){
        return placementThroughTrainApplyInfoConverter.convertGenericResponseDO2DTO(placementThroughTrainApplyInfoDO);
    }

    
    @Override
    protected PlacementThroughTrainApplyInfoDTO doConvertResponseDO2DTO(PlacementThroughTrainApplyInfoDO placementThroughTrainApplyInfoDO) {
        final PlacementThroughTrainApplyInfoDTO placementThroughTrainApplyInfoDTO = new PlacementThroughTrainApplyInfoDTO();
        try {
            BeanUtils.copyProperties(placementThroughTrainApplyInfoDO, placementThroughTrainApplyInfoDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return placementThroughTrainApplyInfoDTO;
    }

}
